package com.wzu.group2.action;

import com.wzu.group2.dao.UserMapper;
import com.wzu.group2.pojo.Role;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class Hello {
    @Resource
    UserMapper userMapper;

    @RequestMapping("/sendToLogin")
    public String sendToLogin(){
        return "login";
    }
    @RequestMapping("/mail")
    public String mail(){
        return "usermail";
    }
    @RequestMapping("/sendToAdd")
    public String sendToAdd(Model model){
        List<Role> roles = userMapper.count_role();
        model.addAttribute("roles",roles);
        return "useradd";
    }
    //跳转
    @RequestMapping("/users")
    public String sendTousers(){
        return "userlist";
    }
    @RequestMapping("/bills")
    public String sendTobills(){
        return "permList";
    }
    @RequestMapping("/sendToregister")
    public String sendToregister(){
        return "userRegister";
    }
    @RequestMapping("/toIndex")
    public String toIndex(){
        return "index";
    }
//    前往添加权限
    @RequestMapping("/perm_add")
    public String send_perm_add(){return "permadd";}
    //前往添加角色
    @RequestMapping("/addRole")
    public String toRole(){ return "roleadd"; }
    //前往添加角色
    @RequestMapping("/unauthentic")
    public String unauthentic(){ return "Unauthorized"; }
    //跳转修改密码
    @RequestMapping("sendToChange")
    public String sendToChange(){

        return "password";
    }


}
